<?php
/**
 * Created by PhpStorm.
 * User: jksen
 * Date: 2018/1/26
 * Time: 下午3:46
 */

namespace app\open\controller;

use think\Request;
use app\common\Utils\Oss;
use app\api\controller\Fun;
/**
 * @title 签名验证类V1
 * @description 接口说明
 *
 * @header name:copyright require:1 default:v1 desc:版本号(全局)
 */
class Auth
{
    /**
     * @title 阿里oss获取上传资质
     * @description
     * @author jikesen
     * @url /open/Auth/getOssPolicy
     * @method POST

     * @param name:dir type:string require:1 default: other:test/ desc:上传目录
     *
     * @return data: []
     */
    public function getOssPolicy()
    {
        $req = Request::instance();

        $dir = $req->param('dir');

        if (empty($dir)) {//添加判断dir 是否存在
            return Fun::error('999995','目录不能为空');
        }

        echo json_encode(Oss::createPolicy($dir));
    }
}